﻿<UserControl x:Class="Hisaab.Windows.Client.View.VehicleTransactionEditorView"
	  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
      xmlns:conv="clr-namespace:Hisaab.Windows.Client.Converters"
      mc:Ignorable="d" d:DesignHeight="416" d:DesignWidth="419">
    <UserControl.Resources>
        <conv:TagListToStringConverter  x:Key="TagConverter" />
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="150" />
            <ColumnDefinition Width="10" />
            <ColumnDefinition Width="250" />
            <ColumnDefinition Width="10*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="34" />
            <RowDefinition Height="34" />
            <RowDefinition Height="34" />
            <RowDefinition Height="34" />
            <RowDefinition Height="34" />
            <RowDefinition Height="34" />
            <RowDefinition Height="34" />
            <RowDefinition Height="34" />
            <RowDefinition Height="34" />
            <RowDefinition Height="34" />
            <RowDefinition Height="34" />
            <RowDefinition Height="34" />
            <RowDefinition Height="34" />
            <RowDefinition Height="138*" />
        </Grid.RowDefinitions>

        <Label Grid.Column="0" Grid.Row="0" Content="Details" Style="{DynamicResource EditorLabel}" />
        <TextBox Grid.Column="2" Grid.Row="0" Text="{Binding Path=SelectedVehicleTransaction.Details, Mode=TwoWay}" Style="{DynamicResource EditorTextBox}" />

        <Label Grid.Column="0" Grid.Row="1" Content="Vehicle" Style="{DynamicResource EditorLabel}" />
        <ComboBox Grid.Column="2" Grid.Row="1"
            ItemsSource="{Binding Path=Vehicles}"
            SelectedValuePath="Id"
            SelectedValue="{Binding Path=SelectedVehicleTransaction.VehicleId, Mode=TwoWay}" Style="{DynamicResource EditorComboBox}">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>

        <Label Grid.Column="0" Grid.Row="2" Content="Date" Style="{DynamicResource EditorLabel}" />
        <DatePicker Grid.Column="2" Grid.Row="2" SelectedDate="{Binding Path=SelectedVehicleTransaction.Date, Mode=TwoWay}" Style="{DynamicResource EditorDatePicker}" />

        <Label Grid.Column="0" Grid.Row="3" Content="Account" Style="{DynamicResource EditorLabel}" />
        <ComboBox Grid.Column="2" Grid.Row="3"
            ItemsSource="{Binding Path=Accounts}"
            SelectedValuePath="AccountId"
            SelectedValue="{Binding Path=SelectedVehicleTransaction.Account, Mode=TwoWay}" Style="{DynamicResource EditorComboBox}">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Name}" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>

        <Label Grid.Column="0" Grid.Row="4" Content="Milage" Style="{DynamicResource EditorLabel}" />
        <TextBox Grid.Column="2" Grid.Row="4" Text="{Binding Path=SelectedVehicleTransaction.Milage, Mode=TwoWay}" Style="{DynamicResource EditorTextBox}" />

        <Label Grid.Column="0" Grid.Row="5" Content="Fill" Style="{DynamicResource EditorLabel}" />
        <TextBox Grid.Column="2" Grid.Row="5" Text="{Binding Path=SelectedVehicleTransaction.Fill, Mode=TwoWay}" Style="{DynamicResource EditorTextBox}" />

        <Label Grid.Column="0" Grid.Row="6" Content="Vehicle" Style="{DynamicResource EditorLabel}" />
        <TextBox Grid.Column="2" Grid.Row="6" Text="{Binding Path=SelectedVehicleTransaction.Vehicle, Mode=TwoWay}" Style="{DynamicResource EditorTextBox}" />

        <Label Grid.Column="0" Grid.Row="7" Content="Oil" Style="{DynamicResource EditorLabel}" />
        <TextBox Grid.Column="2" Grid.Row="7" Text="{Binding Path=SelectedVehicleTransaction.Oil, Mode=TwoWay}" Style="{DynamicResource EditorTextBox}" />

        <Label Grid.Column="0" Grid.Row="8" Content="Service" Style="{DynamicResource EditorLabel}" />
        <TextBox Grid.Column="2" Grid.Row="8" Text="{Binding Path=SelectedVehicleTransaction.Service, Mode=TwoWay}" Style="{DynamicResource EditorTextBox}" />

        <Label Grid.Column="0" Grid.Row="9" Content="Tires" Style="{DynamicResource EditorLabel}" />
        <TextBox Grid.Column="2" Grid.Row="9" Text="{Binding Path=SelectedVehicleTransaction.Tires, Mode=TwoWay}" Style="{DynamicResource EditorTextBox}" />

        <Label Grid.Column="0" Grid.Row="10" Content="Notes" Style="{DynamicResource EditorLabel}" />
        <TextBox Grid.Column="2" Grid.Row="10" Text="{Binding Path=SelectedVehicleTransaction.Notes, Mode=TwoWay}" Style="{DynamicResource EditorTextBox}" />

        <Label Grid.Column="0" Grid.Row="11" Content="Amount" Style="{DynamicResource EditorLabel}" />
        <TextBox Grid.Column="2" Grid.Row="11" Text="{Binding Path=SelectedVehicleTransaction.Amount, StringFormat='{}{0:C}', Mode=TwoWay}" Style="{DynamicResource EditorTextBox}" />

        <!--<Label Grid.Column="0" Grid.Row="5" Content="Tags" />
        <TextBox Grid.Column="2" Grid.Row="5" Text="{Binding Path=Tags, Converter={StaticResource TagConverter}}" />-->
    </Grid>
</UserControl>